<template>
  <div style="border: 1px solid red">
    <h3>child1-1</h3>
    <p>age:{{ $attrs.age }}</p>
    <p>sex:{{ $attrs.sex }}</p>
    <button type="button" @click="fn1">click</button>
    <h3>{{ goods }}</h3>
    <button type="button" @click="fn2">add</button>
  </div>
</template>

<script>
export default {
  name: 'DEMOChild11',

  data() {
    return {}
  },
  created() {
    console.log('child1-1')
  },
  mounted() {
    console.log('child1-1')
  },

  inject: ['goods'],
  methods: {
    fn1() {
      this.$emit('myclick', 23423)
      // this.$listeners.myclick(234)
    },
    fn2() {
      this.goods.push('3123')
    }
  }
}
</script>

<style lang="less" scoped></style>
